import 'server-only';

import { checkEnv } from './utils';

const isProd = process.env.NODE_ENV === 'production';

checkEnv('BETTER_AUTH_SECRET');
checkEnv('BETTER_AUTH_URL');

export default {
  APP_URL: checkEnv('APP_URL'),
  BETTER_AUTH_SECRET: checkEnv('BETTER_AUTH_SECRET'),
  SOCKET_URL: checkEnv('SOCKET_URL'),
  COS_SECRET_ID: checkEnv('COS_SECRET_ID'),
  COS_SECRET_KEY: checkEnv('COS_SECRET_KEY'),
  COS_BUCKET: checkEnv('COS_BUCKET'),
  COS_REGION: checkEnv('COS_REGION'),
  COS_APPID: checkEnv('COS_APPID'),
  REDIS_PASSWORD: checkEnv('REDIS_PASSWORD'),
  REDIS_HOST: checkEnv('REDIS_HOST'),
  REDIS_PORT: checkEnv('REDIS_PORT', '6379'),
  POSTGRES_DB: checkEnv('POSTGRES_DB'),
  POSTGRES_HOST: checkEnv('POSTGRES_HOST'),
  POSTGRES_PORT: checkEnv('POSTGRES_PORT', '5432'),
  POSTGRES_USER: checkEnv('POSTGRES_USER'),
  POSTGRES_PASSWORD: checkEnv('POSTGRES_PASSWORD'),
  GORSE_URL: checkEnv('GORSE_URL'),
  GORSE_KEY: checkEnv('GORSE_KEY'),
  AMAP_KEY: checkEnv('AMAP_KEY'),
  AMAP_SECRET: checkEnv('AMAP_SECRET'),
  DEEPSEEK_API_KEY: checkEnv('DEEPSEEK_API_KEY'),
  KIMI_API_KEY: checkEnv('KIMI_API_KEY'),
  SERVER_IP: isProd ? checkEnv('SERVER_IP') : undefined,
  IS_BUILDING: isProd && process.env.IS_BUILDING === 'true',
};
